package com.zhijiaoyun.model;

import java.math.BigDecimal;
import java.util.Date;

import com.zhijiaoyun.common.CommonUtils;

/**
 * @author shisfish
 * @date 2017/6/6
 */
public class Course extends ModifyModel {
	private static final long serialVersionUID = 7123399921447954522L;

	private Long courseId;

	private String name;

	private String title;

	private Integer lessonNum;

	private String picture;

	private Integer status;

	private String categoryIds;
	
	private String teacherIds;
	
	private String marks;

	private BigDecimal defaultPrice;

	private BigDecimal currentPrice;

	private Integer saleNum;

	private Integer viewNum;

	private Integer maturity;

	private Date maturityTime;

	private String content;
	
	private CourseHistory courseHistory;

	/**
	 * 课程标签
	 * 	热门
	 * 	限时
	 * 		限时，需要在限时表中设置时间
	 * 	试看
	 * 	vip
	 *
	 */
	private Integer label;

	public Course() {
		super();
	}

	public Course(String name, String title, String picture, Integer status, String categoryIds,
			BigDecimal defaultPrice, BigDecimal currentPrice, Integer maturity, String content, 
			String teacherIds, String marks, String createUser) {
		super();
		this.name = name;
		this.title = title;
		this.picture = picture;
		this.lessonNum = 0;
		this.status = status == null ? 0 : status;
		this.categoryIds = categoryIds;
		this.defaultPrice = defaultPrice == null ? new BigDecimal("0") : defaultPrice;
		this.currentPrice = currentPrice == null ? new BigDecimal("0") : currentPrice;
		this.saleNum = 0;
		this.viewNum = 0;
		this.maturity = maturity == null ? 0 : maturity;
		if (this.maturity == 0) {
			this.maturityTime = null;
		} else {
			this.maturityTime = CommonUtils.addYears(this.createTime, this.maturity);
		}
		this.content = content;
		this.teacherIds = teacherIds;
		this.marks = marks;
		this.createUser = createUser;
	}
	
	public Integer getLabel() {
		return label;
	}

	public void setLabel(Integer label) {
		this.label = label;
	}

	public CourseHistory getCourseHistory() {
		return courseHistory;
	}

	public void setCourseHistory(CourseHistory courseHistory) {
		this.courseHistory = courseHistory;
	}

	public Long getCourseId() {
		return courseId;
	}

	public void setCourseId(Long courseId) {
		this.courseId = courseId;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name == null ? null : name.trim();
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title == null ? null : title.trim();
	}

	public Integer getLessonNum() {
		return lessonNum;
	}

	public void setLessonNum(Integer lessonNum) {
		this.lessonNum = lessonNum;
	}

	public String getPicture() {
		return picture;
	}

	public void setPicture(String picture) {
		this.picture = picture == null ? null : picture.trim();
	}

	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}

	public String getCategoryIds() {
		return categoryIds;
	}

	public void setCategoryIds(String categoryIds) {
		this.categoryIds = categoryIds == null ? null : categoryIds.trim();
	}

	public BigDecimal getDefaultPrice() {
		return defaultPrice;
	}

	public void setDefaultPrice(BigDecimal defaultPrice) {
		this.defaultPrice = defaultPrice;
	}

	public BigDecimal getCurrentPrice() {
		return currentPrice;
	}

	public void setCurrentPrice(BigDecimal currentPrice) {
		this.currentPrice = currentPrice;
	}

	public Integer getSaleNum() {
		return saleNum;
	}

	public void setSaleNum(Integer saleNum) {
		this.saleNum = saleNum;
	}

	public Integer getViewNum() {
		return viewNum;
	}

	public void setViewNum(Integer viewNum) {
		this.viewNum = viewNum;
	}

	public Integer getMaturity() {
		return maturity;
	}

	public void setMaturity(Integer maturity) {
		this.maturity = maturity;
	}

	public Date getMaturityTime() {
		return maturityTime;
	}

	public void setMaturityTime(Date maturityTime) {
		this.maturityTime = maturityTime;
	}

	public String getContent() {
		return content;
	}

	public void setContent(String content) {
		this.content = content == null ? null : content.trim();
	}

	public String getTeacherIds() {
		return teacherIds;
	}

	public void setTeacherIds(String teacherIds) {
		this.teacherIds = teacherIds;
	}

	public String getMarks() {
		return marks;
	}

	public void setMarks(String marks) {
		this.marks = marks;
	}

	@Override
	public String toString() {
		return "Course [courseId=" + courseId + ", name=" + name + ", title=" + title + ", lessonNum=" + lessonNum
				+ ", picture=" + picture + ", status=" + status + ", categoryIds=" + categoryIds + ", createTime="
				+ createTime + ", modifyTime=" + modifyTime + ", defaultPrice=" + defaultPrice + ", currentPrice="
				+ currentPrice + ", saleNum=" + saleNum + ", viewNum=" + viewNum + ", maturity=" + maturity
				+ ", maturityTime=" + maturityTime + ", content=" + content + "]";
	}
}